import java.io.File;
import java.math.RoundingMode;
import java.text.DecimalFormat;

public class yingpan {
    public static final String TWO_DECIMAL = "0.00";


    public static void main(String[] args) {
        System.out.println(diskUsage());
    }

    public static double diskUsage() {
        File file = new File(".");

        long usableSpace = file.getUsableSpace();
        System.out.println(usableSpace/1024/1024/1024);
        long totalSpace = file.getTotalSpace();// unallocated / free disk space in bytes.
        System.out.println(totalSpace/1024/1024/1024);
        double diskUsage =(totalSpace-usableSpace * 1.0) / totalSpace;

        DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
        df.setRoundingMode(RoundingMode.HALF_UP);
        return Double.parseDouble(df.format(diskUsage));
    }
}
